<div class="main">
	<form class="form-inline" role="form">
		<div class="form-group">
			<label> 用户列表: </label>
		</div>
	</form>
	<hr/>
	<table class="table table-striped table-hover" style="margin-top: 0px;word-break:break-all; word-wrap:break-all;">
		<thead>
			<tr>
				<td>序号</td>
				<td>姓名</td>
				<td>邮箱</td>
				<td>手机</td>
				<td>角色</td>
				<td>创建时间</td>
				<td>更新时间</td>
				<td>操作</td>
			</tr>
		</thead>
		<tbody>
            <#if response.empty>
			     <tr>
                    <td colspan="7"class="text-center" >
                    	暂无数据
                    </td>
                <tr>
			<#else>
				<#list response.result as user>
					<tr>
						<td>${user_index+1}</td>
						<td>${user.name!}</td>
						<td>${user.email}</td>
						<td>${user.mobile!}</td>
						<td><#if user.type == 0>普通用户<#else>管理员</#if></td>
						<td>${user.createDate?string("yyyy-MM-dd")}</td>
						<td>${user.updateTime?string("yyyy-MM-dd HH:mm:ss")}</td>
						<td>
							<#if user.type == 1>
								<div data-toggle='tooltip' title="是否接收MQCloud发送的各种报警，审批等通知">
									<input onclick="monitor(this,${user.id})" <#if user.receiveNotice == 1>checked="checked"</#if> type="checkbox" style="vertical-align: -2px">接收通知
								</div>
							</#if>
						</td>
					</tr>
				</#list>
			</#if>
		</tbody>
	</table>
</div>
<script>
function monitor(t, uid){
	var flag = 0;
	if($(t).is(':checked')){
		flag = 1;
	}
	$.post('${request.contextPath}/admin/user/monitor',
		{
			uid: uid,
			flag: flag
		},
        function(data){
            if(data.status == 200){
            	toastr.success("设置成功！");  
		    }else{
		    	toastr.error("设置失败！"+data.message);  
		    }
    }, 'json');
}
$(function(){
	$("[data-toggle='modal']").tooltip();
});
</script>
